package com.eastrobot.doc.poitlconvert.util;

import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class MvelFunctionUtil {
    public static String getDate(String format){
        // 基于当前时间进行计算
        Date date = new Date();
        String format1 = DateFormatUtils.format(date, "YYYYMMDD");
        try {
            if(format.equals("MM")){
                format1 = DateUtil.format(date, format);
            }else if(format.equals("YYYY")){
                format1 = DateFormatUtils.format(date, format);
            }
        }catch (Exception e) {
            format1 = DateFormatUtils.format(date, "YYYYMMDD");
        }
        return format1;
    }
}
